import { Children, lazy } from "react";

import { createBrowserRouter } from 'react-router-dom'
import { Navigate } from "react-router-dom";
const Home = lazy(() => import('../path/home/Index'))
const Login = lazy(() => import('../path/login/Index'))
const User = lazy(() => import('../path/user/Index'))
const User1 = lazy(() => import('../path/user/user1/Index'))
const User2 = lazy(() => import('../path/user/user2/Index'))
const List = lazy(() => import('../path/list/Index'))
export const RouterList = [
    {
        path: "/home/list",
        element: <List />,
        title: '列表'
    }, {
        path: '/home/user',
        element: <User />,
        title: '个人',
        children: [
            {
                path: '/home/user/user1',
                element: <User1 />,
                title: '语言'
            }, {
                path: '/home/user/user2',
                element: <User2 />,
                title: '个人1'
            }
        ]
    }
]


export const router = createBrowserRouter([
    {
        path: '/',
        element: <Navigate to={'/home'}></Navigate>
    },
    {
        path: '/home',
        element: <Home />,
        children: RouterList
    }, {
        path: "/login",
        element: <Login />
    }
])